<!doctype html><html lang="zh-Hans-CN"><head>	<meta charset="UTF-8">	<title>猜字游戏</title>	<script>		let win_rate=0;		let play_times=0;		let wins=0;		let last_digits;		let last_win;		function playOnce()	{			let i,digit;			play_times++;			last_digits="";			last_win=false;			for(i=0;i<3;i++){				digit = Math.floor(Math.random()*9)+1;				last_digits += digit;				if (digit==8)					last_win=true;			}			if(last_win)				wins++;			win_rate = Math.floor(100*(wins/play_times));		}	</script></head><body>	<h2>【例1】猜字游戏</h2>	<hr>	<script>		while(true)	{			playOnce();			if (!confirm(last_digits +"\n" +(last_win?"赢":"输") + "\n您累计玩了"+play_times+"次，赢了"+wins+"次，胜率"+win_rate+"%,继续吗?" ))			    break;		}	</script>    <hr>	<p> <script>document.write(document.lastModified);</script> <a href="index.html">返回本章目录</a></p></body></html>